package top.wonew.helper.kugou;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.json.JSONObject;
import top.wonew.helper.kugou.service.KugouLoginSignPkService;
import top.wonew.helper.utils.IResponse;

@Controller
public class KugouController {

    @RequestMapping("/kugou/login/sign/pk")
    @ResponseBody
    public String  hello(@RequestParam(name = "clienttime_ms") String clienttime_ms, @RequestParam(name = "key") String key) throws Exception {
        JSONObject json = new JSONObject();
        json.put("clienttime_ms", clienttime_ms);
        json.put("key", key);
        JSONObject result = new JSONObject();
        result.put("pk", KugouLoginSignPkService.rsaEncrypt(json.toString()));
        return IResponse.success(result).toString();
    }

}
